import fetch from 'common/src/utils/fetch';
import axios from 'axios';
/**
 * 新增免修免考课程
 */
 function addExemptionCourse(data) {
    return fetch({
        url: '/api/electionservice/exemption/addExemptionCourse',
        method: 'post',
        data: data
    });
}

/**
 * 删除免修免考课程
 */
 function deleteExemptionCourse(data) {
    return fetch({
        url: '/api/electionservice/exemption/deleteExemptionCourse',
        method: 'post',
        data: data
    });
}


/**
 * 编辑免修免考课程
 */
function editExemptionCourse(data) {
    return fetch({
        url: '/api/electionservice/exemption/editExemptionCourse',
        method: 'post',
        data: data
    });
}


/**
 * 查询免修免考课程
 */
function findExemptionCourseSelect(data) {
    return fetch({
        url: '/api/electionservice/exemption/findExemptionCourse',
        method: 'post',
        data: data
    });
}

/**
 *新增免修免考规则
 */
function addExemptionCourseRule(data) {
    return fetch({
        url: '/api/electionservice/exemption/addExemptionCourseRule',
        method: 'post',
        data: data
    });
}

/**
 *删除免修免考规则
 */
function deleteExemptionCourseRule(data,applyType) {
    return fetch({
        url: '/api/electionservice/exemption/deleteExemptionCourseRule?applyType='+applyType,
        method: 'post',
        data: data
    });
}


export default {
    "findExemptionCourse": '/api/electionservice/exemption/findExemptionCourse',
    "deleteExemptionCourse":deleteExemptionCourse,
    "addExemptionCourse":addExemptionCourse,
    "editExemptionCourse":editExemptionCourse,
    addExemptionCourseRule:addExemptionCourseRule,
    deleteExemptionCourseRule:deleteExemptionCourseRule,
    findExemptionCourseSelect:findExemptionCourseSelect,
    findExemptionApplyUrl: '/api/electionservice/exemption/findExemptionApply',
    addExemptionApply(data) { // 新增免修申请
        return fetch({
            url: '/api/electionservice/exemption/addExemptionApply',
            method: 'post',
            timeout: 0,
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            transformRequest:function(data){
                return data;
            },
            data,
        });
    },
    editExemptionApply(data) { // 编辑免修申请
        return fetch({
            url: '/api/electionservice/exemption/editExemptionApply',
            method: 'post',
            timeout: 0,
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            transformRequest:function(data){
                return data;
            },
            data: data
        });
    },
    deleteExemptionApply(ids) { // 删除免修申请
        return fetch({
            url: '/api/electionservice/exemption/addExemptionApply',
            method: 'post',
            data: ids
        });
    },
    approvalExemptionApply(status){ // 审批免修免考申请 1审批通过 2 审批未通过
        return fetch({
            url: `/api/electionservice/exemption/approvalExemptionApply？status=${status}`,
            method: 'post',
            data: ids
        });
    },
    exemptionApplyExport(data){ // 导出免修
        return fetch({
            url: `/api/electionservice/exemption/export`,
            method: 'post',
            data: data
        });
    },
    exemptionApplyDownloadFile(fileName){ // 下载excel
        window.location.href = `/api/electionservice/exemption/download?fileName=${fileName}`;
    },
    downloadApplyTemplate(){ //下载免修申请模板
        window.location.href = `/api/electionservice/exemption/downloadApplyTemplate`;
    },
    uploadApplyUrl: '/api/electionservice/exemption/uploadApply'
}